<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >
 
<h:head>
  <title>JSF Demo</title>
</h:head>
<h:body>
  <h:outputScript name="jsf.js" library="javax.faces" target="body">
</h:outputScript>
  <h1>JSF 2 Demo</h1>
  
  
  <h:form>
      
    <rich:messages id="mensagem"  style="color:red;margin:8px;" />
    
 
    CPF: <h:inputText id="cpf" value="#{crudBean.pessoa.cpf}"/>  
    
    Nome: <h:inputText id="nome" value="#{crudBean.pessoa.nome}"/>
 
    <h:commandButton value="Cadastrar" action="#{crudBean.adiciona}">
        <f:ajax  execute="@form" render="@form" />
    </h:commandButton>
    
    <rich:dataTable value="#{crudBean.listaPessoas}" var="pes" id="dtTale">
        
        <h:column> 
            <f:facet name="header"></f:facet>
            <h:commandLink action="#{crudBean.preparaAlteracao}"   value="Alterar" />
        </h:column>
        
            <h:column> 
                <f:facet name="header"></f:facet>
                <h:commandLink action="#{crudBean.deletar}"   value="Excluir" >
                    <f:ajax execute="@form"  render="@form"  /> 
                </h:commandLink>
            </h:column>
        
        <h:column> 
            <f:facet name="header">CPF</f:facet>
            #{pes.cpf}
        </h:column>
        
        <h:column> 
            <f:facet name="header">Nome</f:facet>
            #{pes.nome}
        </h:column>
        
    </rich:dataTable>
       
  </h:form>
 
</h:body>
</html>